#-*- coding: utf-8 -*-
#! /usr/bin/python
import sys
import datetime

reload(sys)
sys.setdefaultencoding("utf-8")


def logit(content, filename='makesnlog.txt'):
    '''
    逐行添加日志，每行一个回车
    头部是时间
    '''
    file = open(filename, 'a')
    try:
        timestr = datetime.datetime.now().strftime('%y-%m-%d %H:%M:%S')+': '
        file.write(timestr+content+'\r\n')
    finally:
        file.close()


def getMacAdd():
    '''
    获得mac地址
    '''
    import uuid
    node = uuid.getnode()
    mac = uuid.UUID(int = node).hex[-12:]
    #print 'Your MAC Address is :'+str(mac)
    return str(mac)

#decode('utf-8').encode('gbk')
mac = getMacAdd()
print '**********************'
print 'Your MAC address is :'+mac
print 'Copy from mac.txt to Service Conductor'
print 'Get your own SN'
print '**********************'
logit(mac, 'mac.txt')
print 'Type Enter key to Exit...'
s = raw_input()
if(s):
    print 'Bye~!'
    exit()
